package GUI;

import javax.swing.filechooser.*;
import java.io.File;

public class PNetFilter extends FileFilter {

  public PNetFilter() {
  }
  public boolean accept (File f) {
    boolean acc = f.isDirectory();
    if (!acc) {
      String suffix = getSuffix(f);
      if (suffix != null)
         acc = suffix.equals("pnet");
    }
    return acc;
  }

  public String getDescription() {
    return "PNet Files(*.pnet)";
  }

  public String getSuffix (File f) {
    String s = f.getPath();
    String suffix = null;
    int i = s.lastIndexOf('.');

    suffix = s.substring(i+1).toLowerCase();

    return suffix;
  }
}